<?php require_once LAYOUTPATH.'layout_header.php'; ?>

<?php require_once FLASHPARTIAL; ?>

<img src="/assets/images/private.png" alt="This BricaBox is private" />
<h1>
	<?php if (!$this->userland->logged_in()): ?>
	<a href="/sign_up_or_log_in">Log in if you're already a member</a>.
	<?php else: ?>
		<?php if ($this->Membership_model->user_applied($BBX['bricabox']->id, $this->userland->current_user()->id)): ?>
		Your membership request is pending.
		<?php else: ?>
		You may <a href="/bricabox/<?php echo $BBX['bricabox']->id; ?>/request_membership">apply to become a member</a>, or <a href="#" onclick="return togglePasscode();">enter the passcode</a> if you know it, too.
		<?php endif; ?>
	<?php endif; ?></h1>

<div id="passcode" style="display: none;">
	<form action="/bricabox/<?php echo $BBX['bricabox']->id; ?>/add_member" method="post">
		<fieldset>
			<div>
				<label for="bricabox_passcode">Type the passcode below:</label><br />
				<input type="text" name="passcode" id="bricabox_passcode" value="" />
			</div>
			<div class="controls">
				<input type="submit" value="Okay, let me in." />
			</div>
		</fieldset>
	</form>
</div>

<script type="text/javascript" charset="utf-8">
	function togglePasscode()
	{
		$('#passcode').show();
		return false;
	}
</script>

<?php require_once LAYOUTPATH.'layout_footer.php'; ?>